#ifndef __APP_SOCK_H__
#define __APP_SOCK_H__
/*-------------------------------------------------------------------
 * include
 *-------------------------------------------------------------------*/
#include <string>

/*-------------------------------------------------------------------
 * include
 *-------------------------------------------------------------------*/
#define BUFFER_SIZE     (2 * 1024)

/*-------------------------------------------------------------------
 * class
 *-------------------------------------------------------------------*/
class SocketApp
{
public:
    enum BUFF_TYPE
    {
        BUFF_R = 0,
        BUFF_W,
    };
    SocketApp(){};
    ~SocketApp(){};

    virtual void read()  = 0;
    virtual void write() = 0;

    int   get_fd();
    void  set_fd(int fd);
    char* get_buff_data(BUFF_TYPE type);
    void  set_buff_size(BUFF_TYPE type, int size);

protected:
    int         fd_{};
    char        buff_write_[BUFFER_SIZE]{};
    char        buff_read_ [BUFFER_SIZE]{};
    int         write_size_{};   /* 需要发送的buffer大小 */
    int         read_size_{};    /* 可以读出的buffer大小 */ 
};

/*-------------------------------------------------------------------
 * class
 *-------------------------------------------------------------------*/
class SocketAppHttp : public SocketApp
{
public:
    SocketAppHttp(){};
    ~SocketAppHttp(){};

    void read() override;
    void write() override;

private:

};

#endif